<!DOCTYPE html>
<html>
<body>
<script src="../../../resources/js-test.js"></script>
<script src="../resources/picker-common.js"></script>
<div id="parent"><input type="date" id="input"></div>
<script>
description('Calender picker should not open when the owner element has no focus.');
var input = document.getElementById('input');
input.focus();
eventSender.keyDown("ArrowDown", ["altKey"]);
input.blur();
if (internals.pagePopupWindow) {
    testFailed('Popup is still open after blur().');
} else {
    testPassed('Popup was closed by blur().');
}
input.focus();
input.remove();
input.offsetTop;
eventSender.keyDown("ArrowDown", ["altKey"]);
if (internals.pagePopupWindow) {
    testFailed('Popup was opened.');
    finishJSTest();
} else {
    testPassed('Popup did not open.');
    finishJSTest();
}
</script>
</body>
</html>
